package com.gjy.ds;

import org.junit.jupiter.api.Test;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-06-20 10:01:59
 */
public class RecursionTest {

    @Test
    public void test1() {
        Long s1 = sum(2L);

        System.out.println(s1);
    }

    private Long sum(Long end) {
        if (end <= 1) {
            return end;
        }
        return sum(end - 1) + end;
    }

}
